package cn.gzsxt.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gzsxt.po.DelayApplyDetail;
import cn.gzsxt.po.TaskDetail;
import cn.gzsxt.service.DelayApplyService;
import cn.gzsxt.service.TaskService;
import cn.gzsxt.service.impl.DelayApplyServiceImpl;
import cn.gzsxt.service.impl.TaskServiceImpl;

import com.alibaba.fastjson.JSON;

@WebServlet("/ChangeDelayTask.oa")
public class ChangeDelayTaskServlet extends HttpServlet {
	
	DelayApplyService service = new DelayApplyServiceImpl();
	TaskService tService = new TaskServiceImpl();
	
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setContentType("application/json;charset=utf-8");
		PrintWriter out = resp.getWriter();
		String id = req.getParameter("id");
		if (id != null && Integer.valueOf(id) != null){
			DelayApplyDetail delay = service.getRow(Integer.valueOf(id));
			TaskDetail task = tService.getRow(Integer.valueOf(id));
			req.setAttribute("delay" , delay);
			req.setAttribute("task", task);
			req.getRequestDispatcher("task/ChangeDelayTask.jsp").forward(req,resp);
		}
	}
	
}
